package com.dream.app.service;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.dream.model.app.AppAbstractUser;
import com.dream.model.app.AppAbstractUser.UserStatus;
import com.dream.model.app.AppImage;
import com.dream.model.app.AppResource;
import com.dream.model.app.AppUser;
import com.dream.utils.hibernate.PagingVO;
import com.dream.vo.app.GroupVO;
import com.dream.vo.app.UserVO;


/**
 * 
 * @copyright evan
 * @author evan
 * @Revision
 * @date 2013-9-8
 */
public interface UserService {
	
	/*
	 * whether the user is existed
	 */
	boolean isExistedUser(final String userId);
	
	/*
	 * register a new user
	 */
	AppUser addNew(final UserVO vo,final AppAbstractUser user);
	
	/**
	 * 
	 * @param user
	 * @return
	 */
	AppUser login(final UserVO vo);
	
	
	/**
	 * 
	 * @param email
	 * @return
	 */
	boolean findPwd(final UserVO vo);
	
	/**
	 * 
	 * @param vo change password
	 */
	void changePwd(final UserVO vo);
	
	/***
	 * 
	 * @copyright evan
	 * @author evan
	 * @date 2013-9-7
	 * @param userId
	 */
	void modifyUser(final UserVO vo,final AppAbstractUser user);
	
	/***
	 * 
	 * @copyright evan
	 * @author evan
	 * @date 2013-9-7
	 * @param userId
	 */
	void modifyUserSetting(final UserVO vo);
	
	/**
	 * 
	 * @author evan
	 * @Revision
	 * @date 2013-9-9
	 * @param vo
	 * @param user
	 */
	void modifyUserResource(final GroupVO vo,final AppAbstractUser user);
	
	/**
	 * 
	 * @author evan
	 * @Revision
	 * @date 2013-9-9
	 * @param userId
	 */
	List<AppResource> getMyResources(final  String  userId);
	
	/***
	 * 
	 * @copyright evan
	 * @author evan
	 * @date 2013-9-7
	 * @param userId
	 */
	void delUser(final String userId,final AppAbstractUser admin);
	
	/**
	 * 
	 * @copyright evan
	 * @author evan
	 * @date 2013-9-3
	 * @param userId
	 * @return
	 */
	AppUser getDetail(final String userId);
	
	/**
	 * 
	 * @param user
	 * @param lockCount
	 * @param unlockHours
	 * @return
	 */
	Boolean isLockedUser(final UserVO userVO,final int lockCount,final int unlockHours);
	
	/**
	 * 
	 * @copyright evan
	 * @author evan
	 * @date 2013-9-2
	 * @param user
	 * @param vo
	 * @param httpRequest
	 * @return
	 * @throws IOException
	 */
	AppImage uploadUserIamge(final AppAbstractUser user, final UserVO vo,final HttpServletRequest httpRequest);
	
	List<AppUser> selectByStatus(UserStatus status);
	
	/**
	 * 
	 * @copyright evan
	 * @author evan
	 * @date 2013-9-4
	 * @param userVO
	 * @param pageVO
	 * @return
	 */
	PagingVO queryUser(final UserVO userVO,final PagingVO pageVO);
	
	/**
	 * 
	 * @author evan
	 * @Revision
	 * @date 2013-11-23
	 * @param deptId
	 * @param positionType
	 * @return
	 */
	List<Map<String, Object>> selectUser(final String deptId, final String positionType);

	List<Map<String, Object>> selectUser(String positionType);
	
}